package com.imooc.exception;

import com.imooc.enums.ResultEnum;
import lombok.Getter;
import lombok.Setter;

/**
 * @author songjun
 * @date 2019/7/24.
 */
@Setter
@Getter
public class BizException extends RuntimeException {
    /**
     * 错误码
     */
    private Integer code;


    public BizException() {

    }

    public BizException(String errorMsg) {
        super(errorMsg);
    }

    public BizException(Integer code, String errorMsg) {
        super(errorMsg);
        this.code = code;
    }

    public BizException(ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.code = resultEnum.getCode();
    }

}
